﻿{% extends "base.html" %} 

{% block title %}pmllib{% endblock %} 

{% block content %}
<div class="container">
    <div class="row">
        <div class="col-md-8">
            {% if user %}
                <div class="alert alert-info" role="alert">
                    <a href="{{ url_for('index') }}">{{ user }} 正在更新。请稍等片刻刷新查看结果。</a>
                </div>
            {% else %}
                <button type="button" id="update" class="btn btn-default navbar-btn" >更新</button>
                <!-- <a type="button" class="btn success" href="/pull">更新</a> -->
            {% endif %}

            <div class="panel panel-default">
                    <!-- Default panel contents -->
                    <div class="panel-heading">最近 30 次更新日志</div>
                    <div class="panel-body">
                        <!-- Table -->
                        <table class="table">
                            <tr>
                                <th>更新者IP</th>
                                <th>更新时间</th>
                            </tr>
                            {% for row in table %}
                            <tr>
                                {% for data in row %}
                                <td>{{ data }}</td>
                                {% endfor %}
                            </tr>
                            {% endfor %}
                        </table>
                    </div>
                
            </div>
        
        </div>
    </div>


</div>
{% endblock %} 

{% block navbar %}
<nav class="navbar navbar-default">
    <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"
                aria-expanded="false">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="{{ url_for('index') }}">Home</a>
        </div>
    </div>
</nav>
{% endblock %}

{% block scripts %}
{{ super() }}
<script>
    jQuery('#update').click(function() {
        window.location = "{{ url_for('pull') }}";
        });
</script>
{% endblock %}